home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Source / MiscGISKit / MiscSphericalCoord.m < prev    next >
Text File  |  1995-07-20  |  2KB  |  79 lines

  1. /*========================= MiscSphericalCoord.m ============================*/
  2. /* MiscSphericalCoord class contains and supports values representing locations
  3.    in a Spherical coordinate system. Angles are stored internally as radians
  4.    at all times, but may be stored or retrieved as degrees.
  5.  
  6.    DMA Release 0.8, Copyright @1993 by Genesis Project, Ltd. All Rights
  7.    Reserved. For further information on terms and conditions see:
  8.         Documentation/GISKit/Agreements-Legal-README
  9.  
  10. HISTORY
  11. 25-Feb-93  Dale Amon at GPL
  12.        Created.
  13. */
  14.  
  15. #import <misckit/miscgiskit.h>
  16.  
  17. @implementation MiscSphericalCoord
  18.  
  19. /*===========================================================================*/
  20. /* Coordinate handling methods */
  21. /*===========================================================================*/
  22. /* set Spherical Coord value from degrees */
  23.  
  24. -setCoordPhiDegrees: (double) phi
  25.        thetaDegrees: (double) theta
  26.         rho: (double) rho
  27.  {    [self  setCoord: [MiscCoord degreesToRadians: phi]
  28.                : [MiscCoord degreesToRadians: theta]
  29.                : rho];
  30.     return self;
  31.  }
  32.  
  33.  
  34. /*---------------------------------------------------------------------------*/
  35. /* Set Spherical Coord value from radians */
  36.  
  37. -setCoordPhiRadians: (double) phi
  38.        thetaRadians: (double) theta
  39.         rho: (double) rho
  40.  {    [self setCoord: phi : theta : rho];
  41.     return self;
  42.  }
  43.  
  44.  
  45. /*---------------------------------------------------------------------------*/
  46. /* Get Spherical Coord value in radians */
  47.  
  48. -coordPhiDegrees: (double *) phi
  49.     thetaDegrees: (double *) theta
  50.          rho: (double *) rho
  51.  {    [self coord: phi : theta : rho];
  52.  
  53.     *phi   = [MiscCoord degreesToRadians: *phi];
  54.     *theta = [MiscCoord degreesToRadians: *theta];
  55.     return self;
  56.  }
  57.  
  58.  
  59. /*---------------------------------------------------------------------------*/
  60. /* Get Spherical Coord value in radians */
  61.  
  62. -coordPhiRadians: (double *) phi
  63.     thetaRadians: (double *) theta
  64.          rho: (double *) rho
  65.  {    [self coord: phi : theta : rho];
  66.     return self;
  67.  }
  68.  
  69. /*---------------------------------------------------------------------------*/
  70. /* spherical coordinates are: phi,theta and rho */
  71.  
  72. -(double) phiRadians    {return [MiscCoord radiansToDegrees: [self coord1]];}
  73. -(double) phiDegrees    {return [self coord1];}
  74. -(double) thetaRadians    {return [MiscCoord radiansToDegrees: [self coord2]];}
  75. -(double) thetaDegrees    {return [self coord2];}
  76. -(double) rho        {return [self coord3];}
  77.  
  78. @end
  79.